import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.nio.channels.FileChannel.MapMode;
import java.nio.MappedByteBuffer;
import java.util.ArrayList;
import java.util.Date;
import java.text.DateFormat;

import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.PreparedQuery;
import com.google.appengine.api.datastore.Query;
import com.google.appengine.api.datastore.Blob;

public class DataStoreWrapper {
	static private DatastoreService datastoreService = null;

	static void storeData(String woeid, WeatherData data, byte[] image) {
		if (datastoreService == null)
			datastoreService = DatastoreServiceFactory.getDatastoreService();

		Entity newData = new Entity("Weather Information");

		newData.setProperty("woeid", woeid);
		newData.setProperty("title", data.getTitle());
		newData.setProperty("city", data.getCity());
		newData.setProperty("region", data.getRegion());
		newData.setProperty("country", data.getCountry());
		newData.setProperty("humidity", data.getHumidity());
		newData.setProperty("visibility", data.getVisibility());
		newData.setProperty("sunrise", data.getSunrise());
		newData.setProperty("sunset", data.getSunset());
		newData.setProperty("temp", data.getTemperature());
	//	newData.setProperty("image.org", new Blob(image));

		 datastoreService.put(newData);
	}
};

